/-boot
/-docs
/-editor
CodeMirrorEditor.ts
CompletionCodeMirrorEditor.ts
CssEditorType.ts
Editor.ts
EditorType.ts
HtmlEditorType.ts
JavaScriptEditorType.ts
TypeScriptEditorType.ts
x-last-PlainTextEditorType.ts
/-files
/-files-old
/-imports
/-layout
/-shell
/-storage
/-tests
/-typings
codemirror.d.ts
knockout.d.ts
typescriptServices.d.ts
websql.d.ts
zip.js.d.ts
Dom.ts
TypeScriptService.ts
functions.ts
ko.ts
nteapo.html
persistence.api.ts
persistence.ts
shell.ts
teapo.html
teapo.js
teapo.ts
try.html
try.js
x
2109
            for (var i = 0; i < emits.outputFiles.length; i++) {
2110
                var ou = emits.outputFiles[i];
2111
                return ou.text;
2112
            }
2113
​
2114
            return null;
2115
        };
2116
​
2117
        TypeScriptEditor.prototype._formatOnKey = function (addedText, removedText, change) {
2118
            if (this._applyingEdits)
2119
                return;
2120
            var doc = this.doc();
2121
            var offset = doc.indexFromPos(change.from);
2122
            offset += addedText.length;
2123
​
2124
            var fullPath = this.docState.fullPath();
2125
            var key = addedText.charAt(addedText.length - 1);
2126
​
2127
            var options = new TypeScript.FormattingOptions();
2128
            options.IndentSize = 2;
2129
            options.TabSize = 2;
2130
            options.ConvertTabsToSpaces = true;
2131
            options.NewLineCharacter = '\n';
2132
​
2133
            var edits = this._typescript.service.getFormattingEditsAfterKeystroke(fullPath, offset, key, options);
2134
​
2135
            this._applyEdits(edits);
2136
        };
2137
​
2138
        TypeScriptEditor.prototype._formatOnPaste = function (addedText, removedText, change) {
2139
            if (this._applyingEdits)
2140
                return;
2141
            var doc = this.doc();
2142
            var offset = doc.indexFromPos(change.from);
2143
​
2144
            var fullPath = this.docState.fullPath();
2145
            var key = addedText.charAt(addedText.length - 1);
2146
​
2147
            var options = new TypeScript.FormattingOptions();
2148
            options.IndentSize = 2;
2149
            options.TabSize = 2;
2150
            options.ConvertTabsToSpaces = true;
2151
            options.NewLineCharacter = '\n';
2152
​
2153
            var edits = this._typescript.service.getFormattingEditsForRange(fullPath, offset, offset + addedText.length, options);
2154
​
2155
            this._applyEdits(edits);
2156
        };
2157
​
2158
        TypeScriptEditor.prototype._applyEdits = function (edits) {
2159
            if (!edits.length)
2160
                return;
2161
​
2162
            //console.log('_applyEdits('+edits.length+')...');
2163
            this._applyingEdits = true;
2164
            var doc = this.doc();
2165
            var orderedEdits = edits.sort(function (e1, e2) {
2166
                return e1.minChar < e2.minChar ? +1 : e1.minChar == e2.minChar ? 0 : -1;
2167
            });
2168
            for (var i = 0; i < orderedEdits.length; i++) {
2169
                var e = orderedEdits[i];
2170
                doc.replaceRange(e.text, doc.posFromIndex(e.minChar), doc.posFromIndex(e.limChar));
2171
            }
2172
            this._applyingEdits = false;
2173
            //console.log('_applyEdits('+edits.length+') - complete.');
2174
        };
2175
​
2176
        /**
2177
        * Invoked from CodeMirror's completion logic
2178
        * either at completion start, or on typing.
2179
        * Expected to return a set of completions plus extra metadata.
2180
        */
2181
        TypeScriptEditor.prototype._continueCompletion = function (forced) {
2182
            var _this = this;
2183
            var editor = this.editor();
2184
            var fullPath = this.docState.fullPath();
179:20